let a1: object;
a1 = {};
a1 = function () {};
//用于指定哪些属性
let b1: { name: string; age?: number }; //加上问好表示属性可选
b1 = { name: "孙悟空" };
let c1: { name: string; [propName: string]: any }; // [propName: string]: any表示可以有任意类型的属性
c1 = { name: "猪八戒", age: 18, gender: "male" };
//定义函数的参数结构 的类型声明
let d1: (a: number, b: number) => number;
d1 = function (a: number, b: number) {
  return a + b;
};

//数组
let e1: string[]; //表示字符串数组
e1 = ["a", "b", "c", "d"];
let f1: number[];
let g1: Array<number>;

//元组
/**
 * 语法: [类型，类型，类型]
 */
let h1: [string, string, number];
h1 = ["hello", "world", 123];

//枚举
/**
 *enum
 */
enum Gender {
  Male = 0, //可以写=0  也可以不写
  Female = 1,
}

let i1: { name: string; gender: Gender };
i1 = {
  name: "孙悟空",
  gender: Gender.Male,
};
console.log(i1.gender === Gender.Female);

// |  表示或   & 表示且

let j1: { name: string } & { age: number };
j1 = { name: "孙悟空", age: 18 };
